home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
source
/
siv
/
scroll1.inc
< prev
next >
Wrap
Text File
|
1994-04-25
|
6KB
|
268 lines
; The SenSiv Scrolling Routines
────────────────────────────────────────────────────────────────────────────────
; Copyright 1994 by SiV productions, All rights reserved.
; Copyright 1994 by Tali Streit, All rights reserved.
────────────────────────────────────────────────────────────────────────────────
; Module1
; ▄▀▀▀▀▀▀▀▄
; █ │ │ █
; █ └─┬─┘ █
; █ │ █
; █ │ █
; ▀▄▄▄▄▄▄▄▀
update_scroll1:
updatescroll1:
rendy:
mov bx, moveY
or bx, bx
js donegY
and bx, 15 ; do not handle scrolls larger then 16..
shl bx, 1
mov ax, rows[bx]
shr bx, 1
add SCRorigin, ax
jmp doposY
donegY: neg bx
and bx, 15 ; do not handle scrolls larger then 16...
shl bx, 1
mov ax, rows[bx]
sub SCRorigin, ax
shr bx, 1
neg bx
doposY:
; shr bx, 1
; mov bx, moveY
add Ypos, bx
add indexY, bx ; The 16 counter index thing.
js goUP
cmp indexY, 16
jb noYch
;
;│ │ ┌── ┌ ┌
;└─┬─┘ │ ├──┤ ─┼─
; │ └── ┘ ┘
;
mov di, mapX ;┌ update the map pointer.
add source, di ;│
mov di, SCRorigin ;┌ calculate 128 pixels down from origin
add di, 128*320 ;│
sub indexY, 16 ;┌ Subtract the error term...
mov bx, indexY ;│
shl bx,1 ;│
sub di, rows[bx] ;│
sub di, indexX ;│
mov si, source
mov ax, mapX
add si, ax ;┌ point to the right line in the map
add si, ax ;│
add si, ax ;│
add si, ax ;│
add si, ax ;│
add si, ax ;│
add si, ax ;│
add si, ax ;│
cmp moveX,0
jns nodoY
; sub di,16
; dec si
nodoY:
; DI points to destination place...
; SI pointe to source place...
add si,mapoff
mov cx,background
call do_row
jmp noYch
;
;│ │ ┌── ┌ ┌
;└─┬─┘ │ ├──┤ ───
; │ └── ┘ ┘
;
goUP: ; indexY should be negative...
mov di,mapX
sub source,di
mov di,SCRorigin
sub di,16*320
mov bx, indexY ;┌ subtract error term.....
neg bx ;│
shl bx, 1 ;│
add di, rows[bx] ;│
sub di, indexX ;│
add indexY, 16 ;┌ make indexY usable again....
mov si, source ;┌ make si point to top line.
; sub si, mapX ;│
cmp moveX, 0
jns nodoY2
;sub di, 16
;dec si
nodoY2:
; DI points to destination place...
; SI pointe to source place...
add si, mapoff
mov cx,background
call do_row
noYch:
; ▄▀▀▀▀▀▀▀▄
; █ │ │ █
; █ └─┬─┘ █
; █ ┌─┴─┐ █
; █ │ │ █
; ▀▄▄▄▄▄▄▄▀
;
rendX:
mov bx, moveX
or bx, bx
js donegX
and bx, 15 ; do not handle scrolls larger then 16..
add SCRorigin, bx
jmp doposX
donegX: neg bx
and bx, 15 ; do not handle scrolls larger then 16...
neg bx
add SCRorigin, bx
doposX: add Xpos, bx
add indexX, bx ; The 16 counter index thing.
js goback
cmp indexX, 16
jb noXch
;
;└┐ ┌┘ ┌── ┌ ┌
; ├─┤ │ ├──┤ ─┼─
;┌┘ └┐ └── ┘ ┘
;
inc source ; Update the source pointer (map)
mov di, SCRorigin ;┌ calculate 128 pixels right from origin
add di, 128 ;│
sub indexX, 16 ;┌ Subtract the error term...
sub di, indexX ;│
mov bx, indexY ;│
shl bx,1 ;│
sub di, rows[bx] ;│
mov si, source
add si, 8
; DI points to destination place...
; SI pointe to source place...
add si,mapoff
mov cx,background
call do_col
jmp noXch
;
;│ │ ┌── ┌ ┌
;└─┬─┘ │ ├──┤ ───
;┌─┴─┐ └── ┘ ┘
;│ │
goback: ; indexX should be negative...
dec source
mov di,SCRorigin
sub di,16
mov bx, indexX ;┌ subtract error term.....
neg bx ;│
add di, bx ;│
mov bx, indexY ;│
shl bx,1 ;│
sub di, rows[bx] ;│
add indexX, 16 ;┌ make indexX usable again....
mov si, source ;┌ make si point to left col
; dec si ;│
; DI points to destination place...
; SI pointe to source place...
add si, mapoff
mov cx,background
call do_col
noXch:
ret
Check1:
mov bx,Xpos
add bx,MoveX
cmp bx,maxXpos
jl noXwrap
neg MoveX
noXwrap:
cmp bx,minXpos
jg noXwarp2
neg MoveX
noXwarp2:
mov bx,Ypos
add bx,MoveY
sub bx,16
cmp bx,maxYpos
jl noYwarp
neg MoveY
noYwarp:
cmp bx,minYpos
jg noYwarp2
neg MoveY
noYwarp2:
ret
initscroll1: ; this takes Xpos and Ypos and calculates the rest.
mov cx,mapx
sub cx,8
shl cx,4
mov maxxpos,cx
mov ax,mapy
sub ax,8
shl ax,4
mov maxYpos,ax
mov bx,Ypos
shl bx,1
mov di,rows[bx]
add di,Xpos
mov SCRorigin,di
mov bx,Xpos
and bx,15
mov indexX,bx
mov bx,Ypos
and bx,15
mov indexY,bx
mov bx, Ypos
shr bx, 4
mov ax, mapX
mul bx
mov source, ax
mov bx, Xpos
shr bx, 4
add source, bx
ret